<template>
  <div v-if="editingFieldDefinition">
    <Component :editingFieldDefinition="editingFieldDefinition"
               :is="editingFieldDefinition.component + 'Configuration'" ref="component"/>
  </div>
</template>

<script>
import TextInputConfiguration from '@/components/form/textInput/TextInputConfiguration.vue';
import NumberInputConfiguration from '@/components/form/numberInput/NumberInputConfiguration.vue';
import EnumInputConfiguration from '@/components/form/enumInput/EnumInputConfiguration.vue';
import DateInputConfiguration from '@/components/form/dateInput/DateInputConfiguration.vue';
import RadioInputConfiguration from '@/components/form/radioInput/RadioInputConfiguration.vue';
import TimeInputConfiguration from '@/components/form/timeInput/TimeInputConfiguration.vue';
import CheckInputConfiguration from '@/components/form/checkInput/CheckInputConfiguration.vue';
import AttachInputConfiguration from '@/components/form/attachInput/AttachInputConfiguration.vue';
import UserInputConfiguration from '@/components/form/userInput/UserInputConfiguration.vue';
import DepartInputConfiguration from '@/components/form/departInput/DepartInputConfiguration.vue';
import UnitInputConfiguration from '@/components/form/unitInput/UnitInputConfiguration.vue';
import TextAreaInputConfiguration from '@/components/form/textAreaInput/TextAreaInputConfiguration.vue';

let components = {
  TextInputConfiguration,
  EnumInputConfiguration,
  DateInputConfiguration,
  RadioInputConfiguration,
  TimeInputConfiguration,
  CheckInputConfiguration,
  AttachInputConfiguration,
  NumberInputConfiguration,
  DepartInputConfiguration,
  UserInputConfiguration,
  TextAreaInputConfiguration,
  UnitInputConfiguration
};
export default {
  name: 'FormPropertyConfiguration',
  components: {
    ...components
  },
  props: {
    editingFieldDefinition: {
      type: Object,
      default: () => undefined
    },
  },
  data() {
    return {
      componentType: ''
    };
  },
  methods: {
    onChangeConfig(config) {
      this.$emit('fieldConfigChange', config);
    },
  }
}
</script>
